package com.zk.tools.controller;


import com.zk.tools.service.InitEmailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/init")
public class InitEmailController {

    @Autowired
    private InitEmailService initEmailService;


    @RequestMapping(value = "/loadOrRrefreshConf", produces = "application/json")
    public String loadOrRrefreshConf(@RequestParam("emailProList") List<Object> emailProList) {
        initEmailService.loadFile();
        return "200";
    }


    /**
     * 初始化 主邮箱
     * 初始化 备份邮箱
     */
    @RequestMapping(value = "/baseConf", produces = "application/json")
    public String baseConf(@RequestParam("emailProList") List<Object> emailProList) {
        initEmailService.loadBaseConf(emailProList);

        return "200";
    }


    @RequestMapping(value = "/userConf", produces = "application/json")
    public String userConf(@RequestParam("sendUserList") List<Object> sendUserList) {
        initEmailService.loadUserList(sendUserList);
        return "200";
    }

    @RequestMapping(value = "/otherConf", produces = "application/json")
    public String otherConf(@RequestParam("otherConf") Map<String, String> confMap) {
        initEmailService.loadOtherConf(confMap);
        return "200";
    }


}
